<template>
  <cu-custom bg-color="bg-white text-black" is-back bg-image="">
    <template #backText>返回</template>
  </cu-custom>
  <view class="container">
    <view class="cu-bar bg-white solid-bottom">
      <view class="action text-black text-bold">
        <text class="cuIcon-titles text-orange"></text>
        <text class="text-xl">自我评价</text>
      </view>
      <view class="action">
        <button
          class="cu-btn bg-gradual-blue shadow"
          form-type="submit"
          @click="save"
        >
          保存
        </button>
      </view>
    </view>
  </view>
  <WangEditor v-model="form.text"></WangEditor>
</template>

<script setup lang="ts">
import { reactive, toRefs } from "vue";
import { onLoad } from "@dcloudio/uni-app";
const state = reactive({
  form: {
    text: "",
  },
});
const { form } = toRefs(state);
onLoad((option: any) => {
  if (option.selfEvaluation) {
    form.value = JSON.parse(decodeURIComponent(option.selfEvaluation)).data;
  }
});
uni.getStorage({
  key: "selfEvaluation",
  success: ({ data }) => {
    console.log(data, "ddd");
  },
});
const save = () => {
  uni.setStorage({
    key: "selfEvaluation",
    data: {
      data: form.value,
      type: 0,
    },
  });
  uni.switchTab({ url: "/pages/index/index" });
};
</script>

<style></style>
